//
//  FindViewController.m
//  QRMaster
//
//  Created by liuyunlong on 15/11/10.
//  Copyright © 2015年 myApple. All rights reserved.
//

#import "FindViewController.h"
#import "ReaderQRCodeViewController.h"
#import "TouchBtnColor.h"
#import "StartPageController.h"
#import "PromptInfoView.h"
#import "OpertionPlist.h"
#import "GesturePasswordController.h"

@interface FindViewController ()<UIAlertViewDelegate>
{
    UILabel * titleNameLabel;
    UILabel * readerLabel;
    NSInteger tokenTimes;
    NSUserDefaults * userInfo;
}

@end

@implementation FindViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self prepareListView];
    userInfo = [NSUserDefaults standardUserDefaults];
}

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    self.navigationItem.title = NSLocalizedString(@"found", nil);
    readerLabel.text = NSLocalizedString(@"scan", nil);
}

-(void)prepareListView
{
    float ScreenWidth = self.view.frame.size.width;
    float x = 0;
    float y = 10;
    float width = ScreenWidth;
    float height = 50;
    
    UIButton * readerQRCodeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    readerQRCodeBtn.frame = CGRectMake(x, y, width, height);
    [readerQRCodeBtn setBackgroundColor:[UIColor whiteColor]];
    [readerQRCodeBtn addTarget:self action:@selector(readClick:) forControlEvents:UIControlEventTouchUpInside];
    [readerQRCodeBtn setBackgroundImage:[TouchBtnColor imageWithColor:RGBA(237, 238, 241, 1) size:readerQRCodeBtn.frame.size] forState:UIControlStateHighlighted];
    [self.view addSubview:readerQRCodeBtn];
    
    x = 20;
    y = 15;
    height = 20;
    width = 20;
    UIImageView * readerImgView = [[UIImageView alloc]initWithFrame:CGRectMake(x, y, width, height)];
    readerImgView.image = [UIImage imageNamed:@"ic_scan"];
    
    [readerQRCodeBtn addSubview:readerImgView];
    
    x += width + 10;
    y = 15;
    height = 20;
    width = ScreenWidth - x;
    readerLabel = [[UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
    readerLabel.text = NSLocalizedString(@"scan", nil);
    readerLabel.font = [UIFont systemFontOfSize:14.0];
    [readerQRCodeBtn addSubview:readerLabel];
    
    x = readerQRCodeBtn.frame.size.width - 40;
    y = 15;
    height = 20;
    width = 20;
    UIImageView * readQRCImgView = [[UIImageView alloc]initWithFrame:CGRectMake(x, y, width, height)];
    readQRCImgView.image = [UIImage imageNamed:@"36右箭头"];
    [readerQRCodeBtn addSubview:readQRCImgView];
}

-(void)readClick:(UIButton *)btn
{
    ReaderQRCodeViewController * rcvc = [[ReaderQRCodeViewController alloc]init];
    rcvc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:rcvc animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
